package itheima;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetDemo {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress byName = InetAddress.getByName("DESKTOP-CQQBUR1");
        String hostName = byName.getHostName();
        System.out.println("主机名为"+hostName);
        String hostAddress = byName.getHostAddress();
        System.out.println("电脑地址"+hostAddress);
    }
}
